package interpreterPattern;

//解释变量：终结符表达式
public class VariableExpression implements Expression {
    private String variable;

    public VariableExpression(String variable) {
        this.variable = variable;
    }

    @Override
    public int interpret(Context context) {
        // 从上下文获取变量的值
        return context.getValue(variable);
    }
}
